
package com.platform.modules.mall.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.platform.common.utils.Query;
import com.platform.modules.mall.dao.MallModuleCategoryDao;
import com.platform.modules.mall.entity.MallModuleCategoryEntity;
import com.platform.modules.mall.service.MallModuleCategoryService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * 模块--分类表Service实现类
 *
 * @author 
 * @date 2021-06-23 10:56:28
 */
@Service("mallModuleCategoryService")
public class MallModuleCategoryServiceImpl extends ServiceImpl<MallModuleCategoryDao, MallModuleCategoryEntity> implements MallModuleCategoryService {

    @Override
    public List<MallModuleCategoryEntity> queryAll(Map<String, Object> params) {
        return baseMapper.queryAll(params);
    }

    @Override
    public Page queryPage(Map<String, Object> params) {
        //排序
        params.put("sidx", "T.SORT");
        params.put("asc", false);
        Page<MallModuleCategoryEntity> page = new Query<MallModuleCategoryEntity>(params).getPage();
        return page.setRecords(baseMapper.selectMallModuleCategoryPage(page, params));
    }

    @Override
    public boolean add(MallModuleCategoryEntity mallModuleCategory) {
        return this.save(mallModuleCategory);
    }

    @Override
    public boolean update(MallModuleCategoryEntity mallModuleCategory) {
        return this.updateById(mallModuleCategory);
    }

    @Override
    public boolean delete(String id) {
        return this.removeById(id);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean deleteBatch(String[] ids) {
        return this.removeByIds(Arrays.asList(ids));
    }
}
